﻿using System;
using System.Linq;
using InvestmentIntelligence.DbModel.Models;

namespace InvestmentIntelligence.Data.Repository.EFImplementation
{
    public class SettingsRepository : IIPRepository<Parameter>, ISettingsRepository
    {
        public T Get<T>(Func<IQueryable<Parameter>, T> f, int userId, string typeName)
        {
            return base.Get(dc => f(dc.Where(c => c.Type == typeName && c.UserId == userId)));
        }

        public T Get<T>(Func<IQueryable<Parameter>, T> f, string typeName)
        {
            return base.Get(dc => f(dc.Where(c => c.Type == typeName)));
        }
    }
}